<?php 
namespace app\admin\validate;
use think\validate;
class ShopValidate extends Validate{
    //验证规则
    protected $rule = array(
		'shop_name' => 'require|max:50',
		'shop_type_id'=>'require|number',
		'shop_type_name' => 'max:50',
		'shop_group_id'=>'number',
		'shop_group_name' => 'max:50',
		'company_name' => 'max:50',
		'province_id'=>'number',
		'city_id'=>'number',
		'district_id'=>'number',
		'address_detail' => 'max:50',
		'shop_zip' => 'max:10',
    		'shop_close_info' => 'max:255',
		'shop_sort'=>'number',
		'shop_banner' => 'max:255',
		'shop_avatar' => 'max:150',
		'shop_keywords' => 'max:255',
		'shop_description' => 'max:255',
		'shop_qq' => 'max:50',
		'shop_ww' => 'max:50',
		'shop_phone'=>'regex:^1[356789]\d{9}',
		'shop_domain' => 'max:50',
    		'shop_credit'=>'number',
		'shop_collect'=>'number',
		'shop_stamp' => 'max:200',
		'shop_printdesc' => 'max:500',
		'shop_sales'=>'regex:\d+\.?\d{0,2}',
		'shop_account'=>'regex:\d+\.?\d{0,2}',
		'shop_cash'=>'regex:\d+\.?\d{0,2}',
		'live_store_name' => 'max:255',
		'live_store_address' => 'max:255',
		'live_store_tel'=>'regex:^1[356789]\d{9}',
		'live_store_bus' => 'max:255',
		'shop_vrcode_prefix' => 'max:3',
                                		'shop_region' => 'max:50',
		'recommend_uid'=>'number',
		'shop_qrcode' => 'max:255',
		'shop_platform_commission_rate'=>'regex:\d+\.?\d{0,2}',
	);
    //验证失败提示信息
    protected $message = array(
		'shop_name.require'=>'店铺名称不能为空',
		'shop_name.max'=>'店铺名称的值不能超过50个字符',
		'shop_type_id.require'=>'店铺等级不能为空',
		'shop_type_id.number'=>'店铺等级的值必须是一个整数',
		'shop_type_name.max'=>'店铺等级名称的值不能超过50个字符',
		'shop_group_id.number'=>'店铺分类的值必须是一个整数',
		'shop_group_name.max'=>'店铺类型名称的值不能超过50个字符',
		'company_name.max'=>'店铺公司名称的值不能超过50个字符',
		'province_id.number'=>'店铺所在省份ID的值必须是一个整数',
		'city_id.number'=>'店铺所在市ID的值必须是一个整数',
		'district_id.number'=>'所在地区ID的值必须是一个整数',
		'address_detail.max'=>'公司详细地址的值不能超过50个字符',
		'shop_zip.max'=>'邮政编码的值不能超过10个字符',
		'shop_close_info.max'=>'店铺关闭原因的值不能超过255个字符',
		'shop_sort.number'=>'店铺排序的值必须是一个整数',
		'shop_banner.max'=>'店铺横幅的值不能超过255个字符',
		'shop_avatar.max'=>'店铺头像的值不能超过150个字符',
		'shop_keywords.max'=>'店铺seo关键字的值不能超过255个字符',
		'shop_description.max'=>'店铺seo描述的值不能超过255个字符',
		'shop_qq.max'=>'QQ的值不能超过50个字符',
		'shop_ww.max'=>'阿里旺旺的值不能超过50个字符',
		'shop_phone.regex'=>'商家电话的值不是正确的手机号码',
		'shop_domain.max'=>'店铺二级域名的值不能超过50个字符',
		'shop_credit.number'=>'店铺信用的值必须是一个整数',
		'shop_collect.number'=>'店铺收藏数量的值必须是一个整数',
		'shop_stamp.max'=>'店铺印章的值不能超过200个字符',
		'shop_printdesc.max'=>'打印订单页面下方说明文字的值不能超过500个字符',
		'shop_sales.regex'=>'店铺销售额（不计算退款）的值不是正确的货币格式',
		'shop_account.regex'=>'店铺账户余额的值不是正确的货币格式',
		'shop_cash.regex'=>'店铺可提现金额的值不是正确的货币格式',
		'live_store_name.max'=>'商铺名称的值不能超过255个字符',
		'live_store_address.max'=>'商家地址的值不能超过255个字符',
		'live_store_tel.regex'=>'商铺电话的值不是正确的手机号码',
		'live_store_bus.max'=>'公交线路的值不能超过255个字符',
		'shop_vrcode_prefix.max'=>'商家兑换码前缀的值不能超过3个字符',
		'shop_region.max'=>'店铺默认配送区域的值不能超过50个字符',
		'recommend_uid.number'=>'推荐招商员用户id的值必须是一个整数',
		'shop_qrcode.max'=>'店铺公众号的值不能超过255个字符',
		'shop_platform_commission_rate.regex'=>'平台抽取佣金比率的值不是正确的货币格式',
);
    //验证场景
    protected $scene = array(
		'add'=>array('shop_name','shop_type_id','shop_type_name','member_id','shop_group_id','shop_group_name','company_name','province_id','city_id','district_id','address_detail','shop_zip','shop_status','shop_close_info','shop_sort','shop_logo','shop_banner','shop_avatar','shop_keywords','shop_description','shop_qq','shop_ww','shop_phone','shop_domain','shop_recommend','shop_credit','shop_desccredit','shop_servicecredit','shop_collect','shop_stamp','shop_printdesc','shop_sales','shop_account','shop_cash','live_store_name','live_store_address','live_store_tel','live_store_bus','shop_vrcode_prefix','store_qtian','shop_zhping','shop_erxiaoshi','shop_tuihuo','shop_shiyong','shop_shiti','shop_xiaoxie','shop_huodaofk','shop_region','recommend_uid','shop_qrcode','shop_platform_commission_rate'),
		'edit'=>array('shop_id','shop_name','shop_type_id','shop_type_name','member_id','shop_group_id','shop_group_name','company_name','province_id','city_id','district_id','address_detail','shop_zip','shop_status','shop_close_info','shop_sort','shop_logo','shop_banner','shop_avatar','shop_keywords','shop_description','shop_qq','shop_ww','shop_phone','shop_domain','shop_recommend','shop_credit','shop_desccredit','shop_servicecredit','shop_collect','shop_stamp','shop_printdesc','shop_sales','shop_account','shop_cash','live_store_name','live_store_address','live_store_tel','live_store_bus','shop_vrcode_prefix','store_qtian','shop_zhping','shop_erxiaoshi','shop_tuihuo','shop_shiyong','shop_shiti','shop_xiaoxie','shop_huodaofk','shop_region','recommend_uid','shop_qrcode','shop_platform_commission_rate'),
	);

}